package TCPThread.file;

import java.io.*;
import java.net.Socket;

public class Send {
    public static void main(String[] args) throws IOException {
        Socket socket =new Socket("127.0.0.1",10086);

        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("unc.han/src/TCP/1111.png"));

        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(socket.getOutputStream());

        byte[] bytes = new byte[1024];
        int x;
        while ((x=bufferedInputStream.read(bytes))!=-1){
            bufferedOutputStream.write(bytes,0,x);


        }


        socket.shutdownOutput();


        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        System.out.println(bufferedReader.readLine());



        socket.close();
    }
}
